Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polished

Package Overview
Dependencies
Maintainers
3
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polished

A lightweight toolset for writing styles in Javascript.

  • 4.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1M
increased by1.26%
Maintainers
3
Weekly downloads
 
Created

What is polished?

Polished is a lightweight toolset for writing styles in JavaScript. It provides a variety of utility functions to help with common CSS-in-JS tasks, such as color manipulation, media queries, and more.

What are polished's main functionalities?

Color Manipulation

Polished provides functions like `lighten` and `darken` to manipulate colors easily. This is useful for creating color schemes and ensuring accessibility.

const { lighten, darken } = require('polished');
const lightenedColor = lighten(0.2, '#ff0000'); // '#ff6666'
const darkenedColor = darken(0.2, '#ff0000'); // '#cc0000'

Mixing Colors

The `mix` function allows you to blend two colors together. This can be useful for creating gradients or finding intermediary colors.

const { mix } = require('polished');
const mixedColor = mix(0.5, '#ff0000', '#0000ff'); // '#800080'

Media Queries

Polished includes utilities for generating media queries, such as the `between` function, which helps in creating responsive designs.

const { between } = require('polished');
const mediaQuery = between('400px', '1000px'); // '@media (min-width: 400px) and (max-width: 1000px)'

Math Functions

Polished offers math functions like `stripUnit` to remove units from values and `modularScale` to generate values based on a modular scale.

const { stripUnit, modularScale } = require('polished');
const value = stripUnit('16px'); // 16
const scaleValue = modularScale(2, '1em', 1.25); // '1.5625em'

Other packages similar to polished

Keywords

FAQs

Package last updated on 01 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc